package com.dmagic.cms.entity;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import org.hibernate.annotations.Where;

import com.dmagic.cms.common.Constants;
import com.dmagic.cms.common.entity.ModifyInfoEntity;
import com.dmagic.cms.common.util.NumberUtil;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@Entity
@Table(name = "dmagic_company")
@Where(clause = ModifyInfoEntity.ISOBSOLETE_DATE_IS_NULL)
@JsonAutoDetect
@JsonIgnoreProperties(value = { "createdBy", "createdOn", "modifiedBy", "modifiedOn", "isObsoleteDate" })
public class Company extends ModifyInfoEntity implements Serializable {

	/**
     * 
     */
	private static final long serialVersionUID = 6223200446267855200L;

	private Long companyId;

	private String companyNo;

	private String companyName;

	private String companyAddress;

	private String companyTel;

	private String companyFax;

	private String companyEmail;

	private String companyUrl;

	private String companyInfo;

	private Long languageId;

	private Integer flag;

	public Company() {
		super();
	}

	public enum Flag {
		ContactUs(0), AboutUs(1);
		private Integer flag;

		private Flag(Integer flag) {
			this.flag = flag;
		}

		public Integer getValue() {
			return flag;
		}

		public boolean compare(Integer flag) {
			return NumberUtil.equals(getValue(), flag);
		}
	}

	@Id
	@GeneratedValue(strategy = GenerationType.TABLE, generator = Constants.ID_GENERATOR)
	@TableGenerator(name = Constants.ID_GENERATOR, // Generator Name which same
													// with
	// generator
	table = Constants.ID_GENERATOR, // Generator Table Name
	pkColumnName = Constants.PK_COLUMNNAME, // Generator Table column Id name
	valueColumnName = Constants.VALUE_COLUMN_NAME, // Generator Table column Id
													// value
	pkColumnValue = "Company", // entity Name
	allocationSize = (Constants.ID_GENERATOR_ALLLCATIONSIZE), initialValue = Constants.ID_GENERATOR_INITIALVALUE)
	public Long getCompanyId() {
		return companyId;
	}

	public void setCompanyId(Long companyId) {
		this.companyId = companyId;
	}

	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	public String getCompanyAddress() {
		return companyAddress;
	}

	public void setCompanyAddress(String companyAddress) {
		this.companyAddress = companyAddress;
	}

	public String getCompanyTel() {
		return companyTel;
	}

	public void setCompanyTel(String companyTel) {
		this.companyTel = companyTel;
	}

	public String getCompanyFax() {
		return companyFax;
	}

	public void setCompanyFax(String companyFax) {
		this.companyFax = companyFax;
	}

	public String getCompanyUrl() {
		return companyUrl;
	}

	public void setCompanyUrl(String companyUrl) {
		this.companyUrl = companyUrl;
	}

	public String getCompanyEmail() {
		return companyEmail;
	}

	public void setCompanyEmail(String companyEmail) {
		this.companyEmail = companyEmail;
	}

	public String getCompanyInfo() {
		return companyInfo;
	}

	public void setCompanyInfo(String companyInfo) {
		this.companyInfo = companyInfo;
	}

	public Long getLanguageId() {
		return languageId;
	}

	public void setLanguageId(Long languageId) {
		this.languageId = languageId;
	}

	public String getCompanyNo() {
		return companyNo;
	}

	public void setCompanyNo(String companyNo) {
		this.companyNo = companyNo;
	}

	public Integer getFlag() {
		return flag;
	}

	public void setFlag(Integer flag) {
		this.flag = flag;
	}

}
